/*
 * Created on 2005-1-25
 *
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.skyeye.modeling.commands;

import org.eclipse.gef.commands.Command;
import org.skyeye.modeling.model.MNode;

public class RenameNodeCommand extends Command {

    private MNode node;

    private String newName;

    private String oldName;

    public void setName(String name) {
        this.newName = name;
    }

    public void setNode(MNode node) {
        this.node = node;
    }

    public void execute() {
        oldName = this.node.getName();
        this.node.setName(newName);
    }

    public void redo() {
        node.setName(newName);
    }

    public void undo() {
        node.setName(oldName);
    }

    public String getLabel() {
        return "Rename Node";
    }
}